Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

205
Visualizações
Electron Forge "formatTime is not defined"

I am attempting to build a timer application using Electron Forge. I found a tutorial here to follow: https://css-tricks.com/how-to-create-an-animated-countdown-timer-with-html-css-and-javascript/

However, as I am attempting to build this application, I get this error from Electron in the DevTools: "Uncaught ReferenceError: formatTime is not defined"

The first place this error gets thrown is in this section of my JavaScript file:

document.getElementById("app").innerHTML = ` <div class="base-timer">
<svg class="base-timer__svg" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<g class="base-timer__circle">
<circle class="base-timer__path-elapsed" cx="50" cy="50" r="45"></circle>
</g>
</svg>
<span id="base-timer-label" class="base-timer__label">
${formatTime(timeLeft)}
</span>`

I can't tell if this is a missing JavaScript library or why formatTime is undefined.

I want to be able to display a timer in one column and then another column with some text.

Could anyone help me understand why this is happening and what I need to do to be able to use this library? Or is there an alternative in Electron/Electron Forge?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I think the tutorial' owner did not add the function. In your link i found function at the "comments" section.

function formatTime(time) {
const hours = Math.floor(time / 60);
const minutes = Math.floor(time / 60);
let seconds = time % 60;

if (seconds < 10) {
seconds = 0${seconds};
}

return ${hours}:${minutes}:${seconds};
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda